home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0295.lzh / AMOSLIST / text0152.txt < prev    next >
Encoding:
Text File  |  1995-03-01  |  1.5 KB  |  38 lines

  1. >     When you want to copy two arrays use the following:
  2. >     
  3. >         Dim a(n),b(n)
  4. >         Copy Varptr(a(0)),Varptr(a(0))+n*4 to varptr(b(0))
  5. >         
  6. >         Try it.It's ultra fast.Try to compare it with:
  7. >         For x=1 to n
  8. >             b(x)=a(x)
  9. >         Next
  10. >         
  11. >         When you want to initialize an array just use:
  12. >             Fill varptr(a(0)) to varptr(a(0))+n*4,0 ; fill it with 0
  13. >        
  14. >         You will notice the difference!
  15. >         
  16. >         Also deek(varptr(a(0))-4) gives N!
  17. >                                             Gregory.
  18.  
  19. However, don't do this if your arrays contain more than 65535 elements in
  20. total, as then AMOS doesn't always store them in continous memory addresses.
  21.  
  22. Also, you might have trouble doing this with string arrays, as AMOS will lose
  23. pointers to its strings, or gain duplicate pointers it doesn't know about.
  24.  
  25.  
  26. +-------------------------+------------------------------------+
  27. |                         |    _____                           |
  28. | PAUL HICKMAN            |   /     \   ON A HOT SUMMER NIGHT  |
  29. | (ph@doc.ic.ac.uk)       |  /  O O  \  WOULD YOU  OFFER YOUR  |
  30. | DEPARTMENT OF COMPUTING | |    _    | THROAT  TO  THE  WOLF  |
  31. | IMPERIAL COLLEGE LONDON |  \  / \  /  WITH THE RED  ROSES ?  |
  32. |                         |   \_____/                          |
  33. +-------------------------+------------------------------------+
  34. Machines: Amiga 500  WB1.3 - 1mb Memory - External Disk Drive.
  35.           Amiga 1200 WB3.0 - 6mb Memory - 200Mb Hard Disk.
  36.  
  37.  
  38.